//
//  StringTool.m
//  电销宝
//
//  Created by welldone on 13-4-9.
//  Copyright (c) 2013年 com.welldone. All rights reserved.
//

#import "StringTool.h"

@implementation StringTool


//ios 判断字符串为空和只为空格解决办法
+ (BOOL)isBlankString:(NSString *)string{
    
    if (string == nil) {
        return YES;
    }
    
    if (string == NULL) {
        return YES;
    }
    
    
    if (![string isKindOfClass:[NSString class]]) {
        return YES;
    }
    
    NSInteger length = [[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length];
    
    if (length==0) {
        return YES; 
    }
    
    if ([string isEqualToString:@"(null)"]) {
        return YES;
    }
    if ([string isEqualToString:@"null"]) {
        return YES;
    }
    if ([string isEqualToString:@"<null>"]) {
        return YES;
    }
    return NO; 
}


+(NSString*)numberForm:(NSString*)numb{

    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    
    
    formatter.numberStyle = NSNumberFormatterDecimalStyle;
    
    
    
    NSString *string = [formatter stringFromNumber:[NSNumber numberWithInteger:numb.integerValue]];
    
    
    NSLog(@"Formatted number string:%@",string);
    

    return string;
}


+(BOOL)contentChinese:(NSString *)str {
    for(int i=0; i< [str length];i++){
        int a = [str characterAtIndex:i];
        if( a > 0x4e00 && a < 0x9fff)
        {
            return YES;
        }
        
    }
    return NO;
}


@end
